package cn.echase.common.core.exception;

import cn.echase.common.core.enums.ResultCode;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.dromara.common.core.constant.HttpStatus;

/**
 * TODO 让文博创建 2.3.0 的echase-common-core -->
 */
@Deprecated
@Data
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
public class EchaseException extends RuntimeException {

    private Integer code;

    private String message;

    public EchaseException(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public EchaseException(String message) {
        this.code = HttpStatus.ERROR;
        this.message = message;
    }

    public EchaseException(ResultCode resultCode) {
        this.code = resultCode.getCode();
        this.message = resultCode.getMessage();
    }

}
